﻿using System.Configuration;
using System.Web.Mvc;
using Chbl.Common.Factories;
using Chbl.DAL;
using Chbl.DataAccess.Repositories;
using Chbl.Factories;
using Chbl.Models;
using Microsoft.Practices.Unity;

namespace Chbl.Unity
{
    public class UnityBootstrapper
    {

        public static void Init()
        {
            IUnityContainer container = new UnityContainer();
            // Registrations
            container.RegisterType<IChblConnectionFactory, ChblConnectionFactory>();
            container.RegisterType<IGalleryServerProRepository, GalleryServerProRepository>(new ContainerControlledLifetimeManager());
            container.RegisterType<ChblDb, ChblDb>();

            ControllerBuilder.Current.SetControllerFactory(new UnityControllerFactory(container));
        }
    }
}